/**
 *
 * Copyright 1991-2010 TEAM International. All rights reserved 
 *
 */
package com.lindenvalley.de;

import java.util.List;

import android.app.Activity;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.ListView;

import com.lindenvalley.de.adapter.ReportArrayAdapter;
import com.lindenvalley.de.content.Question;
import com.lindenvalley.de.database.DbSectionsHelper;
import com.lindenvalley.de.network.WorkServer;

/**
 * @author RuslanI
 *
 */
public class ReportActivity extends Activity {

	private ReportArrayAdapter adapter;
	private int currentThemeId, currentRound;
	/* (non-Javadoc)
	 * @see android.app.Activity#onCreate(android.os.Bundle)
	 */
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.report);
		currentThemeId = getIntent().getIntExtra(MainActivity.EXTRA_THEME_NUMBER, 0);		
		currentRound = getIntent().getIntExtra(MainActivity.EXTRA_ROUND_NUMBER, 0);
		DbSectionsHelper sectionsHelper = new DbSectionsHelper(this);
		SQLiteDatabase database = sectionsHelper.getReadableDatabase();
		List<Question> questions = WorkServer.getInstance().getSections().getSectionById(currentThemeId).getQuestion();
		adapter = new ReportArrayAdapter(this, R.layout.report_list_row, questions, currentThemeId, currentRound);
		ListView lv = (ListView) findViewById(R.id.reportListView1);
		lv.setAdapter(adapter);
//		database.query(DbSectionsHelper.TABLE_NAME, columns, selection, selectionArgs, groupBy, having, orderBy)
		
//		SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.report_list_row, c, from, to)
		
	}

}
